#include <iostream>
#include <cstdio>
#undef UNICODE
#include <windows.h>
#include <tchar.h>
typedef long double db;

const db dif = 1.05L; // D +5%

bool crtDir(const TCHAR* path) {
    DWORD fileAttributes = GetFileAttributes(path);
    if (fileAttributes == INVALID_FILE_ATTRIBUTES) {
        return CreateDirectory(path, NULL);
    } else return fileAttributes & FILE_ATTRIBUTE_DIRECTORY;
}

FILE* dat = fopen("./std.txt", "r");
FILE* output; char path[20];
int n; db d, timLmt;

signed main() {
    fprintf(stderr, "--- Data Generation Start ---\n");
    if (!crtDir("./data/")) return 1;

    fscanf(dat, "T%Lf\n", &timLmt);
    for (int idx = 1; fscanf(dat, "n%d d%Lf\n", &n, &d) != EOF; ++idx) {
        sprintf(path, "./data/%02d.in", n);
        d *= dif, output = fopen(path, "w");
        fprintf(stderr, "#%02d N=%02d D=%06.2Lf path=%s\n", idx, n, d, path);
        fprintf(output, "W%Lf H%Lf\n", d, d);
        for (int i = 1; i <= n; ++i) fprintf(output, "r%d\n", i);
        fprintf(output, "T%Lf\n", timLmt);
    }
    fprintf(stderr, "--- Data Generation Done  ---\n");
}
